<template>
  <div>
    <table>
      <tr>
        <td>书</td>
        <td>作者</td>
        <td>操作</td>
      </tr>
      <tr v-for="i in xiaoshuo" :key="i.id">
        <td>{{ i.name }}</td>
        <td>{{ i.uname }}</td>
        <td>
          <van-button @click="shenhe(1,i.id)">通过</van-button>
          <van-button @click="shenhe(2,i.id)">不通过</van-button>

        </td>
      </tr>
    </table>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: "sh_xiaoshuo",
  data() {
    return {
      xiaoshuo: []
    }
  },
  methods: {
    show_xiaoshuo() {
      axios.get('/zuoye/shenhe').then(res => {
        if (res.data.code == 200) {
          this.xiaoshuo = res.data.list
        }
      })
    },
    shenhe(type, id) {
      axios.post('/zuoye/shenhe', {'type': type, 'id': id})
          .then(res => {
            if (res.data.code == 200) {
              alert('审核通过')
              this.show_xiaoshuo()
            }
          })

    }

  },
  mounted() {
    this.show_xiaoshuo()
  }
}
</script>

<style scoped>

</style>